package com.md.model.bo;

import com.md.util.EncryptionUtils;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 密钥BO
 *
 * @author 刘骄阳
 * 2024-02-23 16:54
 */
@Data
@AllArgsConstructor
public final class SecretKey {
  private String accessKey;
  private String accessKeySecret;

  private SecretKey() {

  }

  public static SecretKey encoding(final String accessKey, final String accessKeySecret, final String salt) {
    return new SecretKey(EncryptionUtils.aesEncryption(salt, accessKey),
      EncryptionUtils.aesEncryption(salt, accessKeySecret));
  }

  public static SecretKey decoding(final String accessKey, final String accessKeySecret, final String salt) {
    return new SecretKey(EncryptionUtils.aesDecryption(salt, accessKey),
      EncryptionUtils.aesDecryption(salt, accessKeySecret));
  }

}
